package com.cn.wanxi.servlet.cuisine;

import com.alibaba.fastjson.JSONObject;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.CuisineService;
import com.cn.wanxi.service.impl.CuisineServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/back/cuisine/findAll/isShow")
public class CuisineFindAllIsShowServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

//        2.得到前端传递过来的值
//        3.将这些值进行封装到model对象
//        4.调用服务逻辑层
        CuisineService cuisineService=new CuisineServiceImpl();
//        5.得到服务逻辑层的值
        ResultModel resultModel=cuisineService.findAllIsShow();
//        6.将值返回给前端
        resp.getWriter().println(JSONObject.toJSONString(resultModel));
    }
}
